﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.SessionState;
using System.Web.Routing;
using System.Reflection;

namespace SimpleRest.Core
{
    /// <summary>
    /// Event argument class that is used when raising an error via the associated Configuration during the pipeline.
    /// </summary>
    public class ErrorHandlerEventArgs : EventArgs
    {
        public ErrorHandlerEventArgs(Exception exception, Type service, IHttpRequestMessage requestMessage, IHttpResponseMessage response)
        {
            this.Exception = exception;
            this.Service = service;
            this.RequestMessage = requestMessage;
            this.ResponseMessage = response;
        }

        /// <summary>
        /// The actual exception that was thrown.
        /// </summary>
        public Exception Exception { get; private set; }
        /// <summary>
        /// The service type that was being requested, if it could be determined.
        /// </summary>
        public Type Service { get; private set; }
        /// <summary>
        /// The request information (if any could be determined).
        /// </summary>
        public IHttpRequestMessage RequestMessage{ get; private set; }
        /// <summary>
        /// The response information (if any could be determined.  This can be manipulated and modified to return content from the error
        /// handler that was invoked in the event that developer wishes to do so.
        /// </summary>
        public IHttpResponseMessage ResponseMessage { get; private set; }
    }
}
